package com.botann.projects.controller;

import com.botann.projects.base.BaseController;
import com.botann.projects.utils.wechat.pay.WechatPayUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * jiyi
 * WechatPayController
 * Created by 刘山国 on 2019/9/19.
 * Copyright (c) 2017 伯坦科技. All rights reserved
 */
@RestController
public class WechatPayController extends BaseController {
    @Override
    public Class loggerClass() {
        return WechatPayController.class;
    }

//    @Autowired
//    UserServiceIntf service;

    //这里是支付回调接口，微信支付成功后会自动调用
    @RequestMapping(value = "/public/wxNotify", method = RequestMethod.POST)
    public void wxNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
        try {
//            Map<String,String > map = WechatPayUtil.onResponse(request,response,logger, service);
//            String billNo = map.get("outTradNo");
//            logger.info(billNo+"===");
//            if (billNo != null) service.updateDoneBill(billNo, map.get("res"));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }



}
